import { PropType, ExtractPropTypes } from 'vue';
import  aiMasterSchema from "../src/schema/ai-master.schema.json";
import {schemaMapper} from "../src/schema/schema-mapper";
import { createPropsResolver } from '../../dynamic-resolver';

export interface Remote {
    url: string;
    method?: 'GET' | 'POST' | 'PUT';
    headers?: any;
    body?: any;
}

export const aiMasterProps = {
    /**
     * 是否显示对话框
     */
    showDialog: { type: Boolean, default: false },
    /**
     * 输入内容
     */
    textarea: { type: String, default: '' },
    /**
     * 请求地址
     */
    postUrl: { type: String, default: '' },
    /**
     * 输入框Tab键索引
     */
    messageList:  { type: Array, default: [{sender: "萌神", content: "萌神测试语音"},{sender: "张三", content: "张三测试语音"}] },
    /**
     * 远端数据源
     */
    remote: { default: null, type: Object as PropType<Remote> },
    /**
     * 发送者
     */
    sender: { type: String, default: '' },
    /**
     * 授权令牌
     */
    authorization: { type: String, default: '' },
    /**
     * API接口地址
     */
    apiUrl: { type: String, default: '' }
};

export type AiMasterProps = ExtractPropTypes<typeof aiMasterProps>;

export const propsResolver = createPropsResolver<AiMasterProps>(aiMasterProps, aiMasterSchema, schemaMapper);
